<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-model双向绑定</title>
</head>

<body>
    <div id="app">
        <table>
            <tr>
                <td>
                    <label for="">名字: </label>
                </td>
                <td>
                    <input type="text" v-model="formData.name">
                </td>
            </tr>
            <tr>
                <td>
                    <label for="">年龄: </label>
                </td>
                <td>
                    <input type="text" v-model="formData.age">
                </td>
            </tr>
        </table>
        <h1>
            {{str}}
        </h1>
    </div>
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <script>
        let app = new Vue({
            el: '#app',
            data() {
                return {
                    formData:{
                            name:'',
                            age:''
                    }
                }
            },

            computed: {
                str(){
                    return `名字: ${this.formData.name} 年龄: ${this.formData.age}`
                }
            }
        })
    </script>
</body>

</html>